package oplog

import (
	"context"
	"devops-super/api/syslog/v1"
	"devops-super/internal/service"
)

func (*ControllerV1) GetPageLst(ctx context.Context, req *v1.GetPageLstReq) (res *v1.GetPageLstRes, err error) {
	res = &v1.GetPageLstRes{}
	res, err = service.Oplog().GetPageLst(ctx, req)
	return
}

func (*ControllerV1) GetOne(ctx context.Context, req *v1.GetOneReq) (res *v1.GetOneRes, err error) {
	res = &v1.GetOneRes{}
	res.Info, err = service.Oplog().GetOne(ctx, req.OperId)
	return
}

func (*ControllerV1) Add(ctx context.Context, req *v1.AddReq) (res *v1.AddRes, err error) {
	err = service.Oplog().Add(ctx, req.OperLog)
	return
}

func (*ControllerV1) Del(ctx context.Context, req *v1.DelReq) (res *v1.DelRes, err error) {
	err = service.Oplog().Del(ctx, req.OperId)
	return
}

func (*ControllerV1) BatchDel(ctx context.Context, req *v1.BatchDelReq) (res *v1.BatchDelRes, err error) {
	err = service.Oplog().BatchDel(ctx, req.OperIds)
	return
}
